import request from '@/utils/request'
import { getUserInfo } from '@/utils/auth'

export function loadDataUrl() {
  return 'v1/orgSetMng/loadData'
}

export function findUserByOrgCodeUrl() {
  return 'v1/userMng/findUserByOrgCode'
}

export function findUserByCpyCodeUrl() {
  return 'v1/userMng/findUserByCpyCode'
}

export function viewMainData(data) {
  return request({
    url: 'v1/orgSetMng/toView',
    method: 'post',
    data
  })
}

export function getOrgSetsByCpyCode() {
  const userInfo = getUserInfo()
  const data = { cpyCode: userInfo.cpyCode }
  return request({
    url: 'v1/orgSetMng/getOrgSetsByCpyCode',
    method: 'post',
    data
  })
}

export function addOrEdit(data) {
  return request({
    url: 'v1/orgSetMng/doSave',
    method: 'post',
    data
  })
}

export function del(data) {
  return request({
    url: 'v1/orgSetMng/doDelete',
    method: 'post',
    data
  })
}

export function saveUserOrgSet(data) {
  return request({
    url: 'v1/orgSetMng/saveUserOrgSet',
    method: 'post',
    data
  })
}

export function deleteUserOrgSet(data) {
  return request({
    url: 'v1/orgSetMng/deleteUserOrgSet',
    method: 'post',
    data
  })
}

